package com.wiki4j.gdo.impl;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

public class JSON{
  private static final ObjectMapper om=new ObjectMapper();
  static{
    om.configure(SerializationFeature.INDENT_OUTPUT,true);
  }

  public static String toJson(Object object){
    try{
      return om.writeValueAsString(object);
    }catch(JsonProcessingException e){
      throw new IllegalStateException("Fail to json serializer!");
    }
  }
}
